package com.xdap.keymen.controller.punch;


import com.xdap.keymen.service.punch.PunchCustomerService;
import com.xdap.keymen.service.punch.PunchService;
import com.xdap.motor.annotation.RestWrapper;
import com.xdap.motor.vo.ResponseVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/custom/punch/customer")
@RequiredArgsConstructor
@Slf4j
public class PunchCustomerController {

    private final PunchCustomerService punchCustomerService;

    @GetMapping("/count")
    @RestWrapper
    public ResponseVo getCustomerCount(Long rv) {
        return ResponseVo.ok().setData(punchCustomerService.countCustomers(rv));
    }

    /**
     * 获取客户列表
     * @param rv
     * @return
     */
    @GetMapping("/list")
    @RestWrapper
    public ResponseVo getCustomerList(Long rv) {
        return punchCustomerService.getCustomerList(rv);
    }

    @GetMapping("/maxRvid")
    @RestWrapper
    public ResponseVo getMaxRvid(String rvidTable) {
        return ResponseVo.ok().setData(punchCustomerService.getMaxRvid(rvidTable));
    }


}
